<?php
$packages = Package::instance()->get(array('status'=> 1, 'type'=> 'hosting'));
Table::instanceTable('Price')->joinTo('prices', 'packageId', 'id', $packages, Table::JOIN_MANY);

foreach ($packages as $keyPackage => $package){
	$min = 1000000;
	foreach ($package['prices'] as $keyPrice => $price){
		if($price['price'] < $min) { $min = $price['price']; $minPrice = $price; }
	}
	if(!isset($minPrice)){
		$minPrice = array('price'=> '-', 'month'=> '-');
	}
	$packages[$keyPackage]['minPrice'] = $minPrice;
}
View::display('hosting', array('packages'=> $packages));